<?php 
define('ACC', true);
require('../include/init.php');
if (empty($_POST['cat_name'])) {
	echo '栏目名不能为空';
}
$data=array();
$data['parent_id']=$_POST['parent_id']+0;
$data['cat_name']=$_POST['cat_name'];
$data['intro']=$_POST['intro'];
$cat_id=$_POST['cat_id']+0;
$ins=new Categorymodel();
$tree=$ins->getFamily($data['parent_id']);
$flag=true;
foreach ($tree as $value) {
	if ($value['cat_id'] == $cat_id) {
		$flag=false;
		break;
		
	}
}
if (!$flag) {
	echo 'aaa';
	exit;
}
if($ins->update($data,$cat_id)){
	echo '修改成功';
}else{
	'修改失败';
}